import {get,put,del,post} from "../../../utils/request/axios";

export const pageRoleList = (obj) =>{
  const url = "/leader/sysRole/page";
  return get(url,obj);
}

export const addRole = (obj) =>{
  const url = "/leader/sysRole";
  return post(url,obj);
}

export const updateRole = (id,obj) =>{
  const url = "/leader/sysRole/"+id;
  return put(url,obj);
}

export const deleteRole = (id) =>{
  const url = "/leader/sysRole/"+id;
  return del(url);
}

/**
 * 根据用户ID查询可授权角色
 * @param id
 * @param obj
 * @returns {Promise}
 */
export const listRoleByUser = (id) =>{
  const url = "/leader/sysRole/listRoleAndCheckRoleByUserId/"+id;
  return get(url);
}

export const authorizationUserMenuPermissions = (id,obj) =>{
  const url = "/leader/sysRoleMenu/authorizationMenuAndPermissionsToRole/"+id;
  return post(url,obj);
}
